#define _CRT_SECURE_NO_WARNINGS 1


void turn(int* nums, int size)
{
    int* head = nums;
    int* tail = nums + size - 1;
    int tmp;
    while (head < tail)
    {
        tmp = *head;
        *head = *tail;
        *tail = tmp;
        ++head;
        --tail;
    }
}
void rotate(int* nums, int numsSize, int k) {
    k = k % numsSize;
    turn(nums, numsSize - k);
    turn(nums + numsSize - k, k);
    turn(nums, numsSize);
}

